﻿using System;

internal class Program01
{
    static void Main(string[] args)
    {   
        int a=int.Parse(Console.ReadLine());
        int b=int.Parse(Console.ReadLine());
        Rectangle rectangle = new Rectangle(a,b);
        Console.WriteLine("矩形长为：" +rectangle.Length+"宽为："+rectangle.Width+"面积为："+rectangle.getArea());
        Console.WriteLine("矩形形状是否合理：" + rectangle.isValid());
        Square square = new Square(a);
        Console.WriteLine("正方形边长为：" + square.Side + "面积为：" + square.getArea());
        Console.WriteLine("正方形形状是否合理："+square.isValid());
        Triangle triangle = new Triangle(a, b);
        Console.WriteLine("三角形底为：" + triangle.BaseLength + "高为：" + triangle.Height + "面积为：" + triangle.getArea());
        Console.WriteLine("三角形形状是否合理："+triangle.isValid());
    }

       
    }
interface Shape
{
    double getArea();
    bool isValid();
}
public class Rectangle: Shape {
    double length, width;
    public Rectangle() { }
    public Rectangle(double length, double width)
    {
        this.length = length;
        this.width = width;
    }
    public double getArea()
    {
        return length * width;
    }
    public bool isValid()
    {
        if(length > 0 && width > 0) { 
            return true;
        }
        return false;
    }
    
    public double Length
    {
        get => length;
        set => length = value;
    }
    public double Width 
    {
        get => width;
        set => width = value;
    }
}
public class Square : Shape
{
    double side;
    public Square() { }
    public Square(double side)
    {
        this.side = side;
    }

    public double getArea()
    {
        return side * side;
    }
    public bool isValid() 
    { 
        if (side > 0)
        {
            return true;
        }
        return false;
    }
    public double Side
    {
        get => side;
        set => side = value;
    }
}

public class Triangle : Shape
{
    double Base, height; 
    public Triangle() { }
    public Triangle(double Base, double height)
    {
        this.Base = Base;
        this.height = height;
    }

    public double getArea()
    {
        return Base * height/2;
    }
    public bool isValid()
    {
        if (Base > 0 && height > 0)
        {
            return true;
        }
        return false;
    }
    public double BaseLength
    {
        get => Base;
        set => Base = value;
    }
    public double Height
    {
        get => height;
        set => height = value;
    }
}
